<?php
/**
 * Dispatch Return
 */
class DR extends AppModel {
    var $name = 'DR';

    var $useTable = 'dispatch_returns';

    const ITS_STOCK_IN_TYPE = 'DR';

    var $belongsTo = array('Product', 'CustProductSite',
        'DRH' => array(
            'foreignKey' => 'dispatch_return_head_id'
        ),
    );

    var $hasMany = array(
        'ProductSerial' => array(
            'foreignKey' => 'its_stock_in_id',
            'conditions' => array(
                'its_stock_in_type' => self::ITS_STOCK_IN_TYPE
            )
        )
    );

    var $validate = array(
        'return_qty' => array(
                'rule' => 'numeric',
                'message' => 'Please input return qty.',
                'on' => 'create'
        ),
    );
}
?>
